package com.ruoyi.ffmpeg;

import org.apache.commons.lang3.StringUtils;
import ws.schild.jave.info.MultimediaInfo;
import ws.schild.jave.progress.EncoderProgressListener;

public class EncoderProgressListenerImpl  implements EncoderProgressListener {

    private int last = 0;

    @Override
    public void sourceInfo(MultimediaInfo info) {
        System.out.println(info);
        System.out.println(info.getFormat());
    }

    @Override
    public void progress(int permil) {
        if(permil/10 != last) {
            last = permil/10 ;
            System.out.println(StringUtils.repeat("*", last) + permil/10);
        }
    }

    @Override
    public void message(String message) {
        System.out.println(message);
    }
}
